// 这个是在写 AtomGit 讨论的时候，试下分组筛选的功能实现
const allCategories = [
  {
    createdDate: "2023-07-21T10:02:27+08:00",
    lastModifiedDate: "2023-07-21T10:02:27+08:00",
    createdBy: "62be5b4d475ae6a337dd47e7",
    createdByUserName: null,
    createdByUserPhoto: null,
    lastModifiedBy: null,
    categoryName: "分享和展示",
    categoryIcon: null,
    categoryDesc: "分享展示你的作品、成果",
    categoryType: 1,
    sectionId: null,
    id: "5d847a3196544baa82e31174e6ae932e",
  },
  {
    createdDate: "2023-07-21T10:02:27+08:00",
    lastModifiedDate: "2023-07-21T10:02:27+08:00",
    createdBy: "62be5b4d475ae6a337dd47e7",
    createdByUserName: null,
    createdByUserPhoto: null,
    lastModifiedBy: null,
    categoryName: "公告",
    categoryIcon: null,
    categoryDesc: "项目维护者提供最新消息和新闻",
    categoryType: 3,
    sectionId: null,
    id: "452a960c73224ff585f27343e2196b56",
  },
  {
    createdDate: "2023-07-21T10:02:27+08:00",
    lastModifiedDate: "2023-07-21T10:02:27+08:00",
    createdBy: "62be5b4d475ae6a337dd47e7",
    createdByUserName: null,
    createdByUserPhoto: null,
    lastModifiedBy: null,
    categoryName: "投票讨论",
    categoryIcon: null,
    categoryDesc: "在社区中对讨论的内容发起投票",
    categoryType: 4,
    sectionId: null,
    id: "c2f559b6cac24af6a8fadf73173ddace",
  },
  {
    createdDate: "2023-07-21T10:02:27+08:00",
    lastModifiedDate: "2023-07-21T10:02:27+08:00",
    createdBy: "62be5b4d475ae6a337dd47e7",
    createdByUserName: null,
    createdByUserPhoto: null,
    lastModifiedBy: null,
    categoryName: "问答求助",
    categoryIcon: null,
    categoryDesc: "向社区成员寻求帮助",
    categoryType: 2,
    sectionId: null,
    id: "58f4b8dd055d44c5ab1ebb7f43b96d82",
  },
  {
    createdDate: "2023-07-21T10:02:27+08:00",
    lastModifiedDate: "2023-07-24T11:09:55+08:00",
    createdBy: "62be5b4d475ae6a337dd47e7",
    createdByUserName: null,
    createdByUserPhoto: null,
    lastModifiedBy: null,
    categoryName: "开放讨论",
    categoryIcon: null,
    categoryDesc: "不适合在其他分类中讨论的与项目相关的任务及所有内容",
    categoryType: 1,
    sectionId: "50b2c04544754a61bf7a7938c70f5732",
    id: "9290e10b767b41e9bf040f6abab48454",
  },
  {
    createdDate: "2023-07-21T10:02:27+08:00",
    lastModifiedDate: "2023-07-24T11:09:55+08:00",
    createdBy: "62be5b4d475ae6a337dd47e7",
    createdByUserName: null,
    createdByUserPhoto: null,
    lastModifiedBy: null,
    categoryName: "想法或创意",
    categoryIcon: null,
    categoryDesc: "分享新功能的想法或创意",
    categoryType: 1,
    sectionId: "50b2c04544754a61bf7a7938c70f5732",
    id: "0bc42a9cbdd64709956727badea91dbd",
  },
];
const categoryList = [
  {
    createdDate: "2023-07-21T10:02:27+08:00",
    lastModifiedDate: "2023-07-24T11:09:55+08:00",
    createdBy: "62be5b4d475ae6a337dd47e7",
    createdByUserName: null,
    createdByUserPhoto: null,
    lastModifiedBy: null,
    categoryName: "开放讨论",
    categoryIcon: null,
    categoryDesc: "不适合在其他分类中讨论的与项目相关的任务及所有内容",
    categoryType: 1,
    sectionId: "50b2c04544754a61bf7a7938c70f5732",
    id: "9290e10b767b41e9bf040f6abab48454",
  },
  {
    createdDate: "2023-07-21T10:02:27+08:00",
    lastModifiedDate: "2023-07-24T11:09:55+08:00",
    createdBy: "62be5b4d475ae6a337dd47e7",
    createdByUserName: null,
    createdByUserPhoto: null,
    lastModifiedBy: null,
    categoryName: "想法或创意",
    categoryIcon: null,
    categoryDesc: "分享新功能的想法或创意",
    categoryType: 1,
    sectionId: "50b2c04544754a61bf7a7938c70f5732",
    id: "0bc42a9cbdd64709956727badea91dbd",
  },
];

const result = allCategories.map((each) => {
  return {
    ...each,
    checked: categoryList.findIndex((element) => element.id === each.id) !== -1,
  };
});
console.log(result);

const arr1 = [
  {
    name: "aaa",
    value: "bbb",
  },
  {
    name: "222",
    value: "bb33b",
  },
];

console.log(arr1.map((item) => item.name));
